<?php echo $header; ?>
<div id="content">
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <?php if ($error_warning) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/customer.png" alt="" /> <?php echo $heading_title; ?></h1>
      <div class="buttons"><a onclick="$('#form').submit();" class="button"><?php echo $button_save; ?></a><a onclick="location = '<?php echo $cancel; ?>';" class="button"><?php echo $button_cancel; ?></a></div>
    </div>
    <div class="content">
      <div id="htabs" class="htabs"><a href="#tab-general"><?php echo $tab_general; ?></a>
        <a href="#tab_address"><?php echo $tab_address; ?></a><a href="#tab_login_ip"><?php echo $tab_login_ip; ?></a>
        <a href="#tab_backlist"><?php echo $tab_backlist; ?></a></div>
      <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
        <div id="tab-general">
            <table class="form">
              <tr>
                <td><?php echo $entry_firstname; ?></td>
                <td><?php echo $firstname; ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_lastname; ?></td>
                <td><?php echo $lastname; ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_sex; ?></td>
                <td><?php if ($sex) { echo $text_sex_man; } else { echo $text_sex_woman;} ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_customer_language; ?></td>
                <td><?php echo $language_name; ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_email; ?></td>
                <td><?php echo $email; ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_phone; ?></td>
                <td><?php echo $phone; ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_fax; ?></td>
                <td><?php echo $fax; ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_newsletter; ?></td>
                <td><?php if ($newsletter) { echo $text_yes; } else { echo $text_no;} ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_point; ?></td>
                <td><?php echo $point; ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_customer_grade; ?></td>
                <td><select name="customer_grade_id">
                    <?php foreach ($customer_grades as $customer_grade) { ?>
                    <?php if ($customer_grade['customer_grade_id'] == $customer_grade_id) { ?>
                    <option value="<?php echo $customer_grade['customer_grade_id']; ?>" selected="selected"><?php echo $customer_grade['name']; ?></option>
                    <?php } else { ?>
                    <option value="<?php echo $customer_grade['customer_grade_id']; ?>"><?php echo $customer_grade['name']; ?></option>
                    <?php } ?>
                    <?php } ?>
                  </select></td>
              </tr>
              <tr>
                <td><?php echo $entry_register_ip; ?></td>
                <td><?php echo $register_ip; ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_status; ?></td>
                <td><?php if ($status) { echo $text_enabled; } else { echo $text_disabled;} ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_date_added; ?></td>
                <td><?php echo $date_added; ?></td>
              </tr>
            </table>
        </div>
        <div id="tab_address">
          <div id="vtabs" class="vtabs">
            <?php $address_row = 1; ?>
            <?php foreach ($addresses as $address) { ?>
            <a href="#tab-address-<?php echo $address_row; ?>" id="address-<?php echo $address_row; ?>"><?php echo $tab_address . ' ' . $address_row; ?></a>
            <?php $address_row++; ?>
            <?php } ?>
          </div>
          <?php $address_row = 1; ?>
          <?php foreach ($addresses as $address) { ?>
          <div id="tab-address-<?php echo $address_row; ?>" class="vtabs-content">
            <table class="form">
              <tr>
                <td><?php echo $entry_firstname; ?></td>
                <td><?php echo $address['firstname']; ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_lastname; ?></td>
                <td><?php echo $address['lastname']; ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_country; ?></td>
                <td><?php echo $address['country_name']; ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_zone; ?></td>
                <td><?php echo $address['zone_name']; ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_city; ?></td>
                <td><?php echo $address['city_name']; ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_address_1; ?></td>
                <td><?php echo $address['address_1']; ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_address_2; ?></td>
                <td><?php echo $address['address_2']; ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_postcode; ?></td>
                <td><?php echo $address['postcode']; ?></td>
              </tr>
              <tr>
                <td><?php echo $entry_default; ?></td>
                <td><?php if ($address['is_default']) { echo $text_yes; }else{ echo $text_no; } ?></td>
              </tr>
            </table>
          </div>
          <?php $address_row++; ?>
          <?php } ?>
        </div>
        <div id="tab_login_ip">
          <table class="list">
            <thead>
              <tr>
                <td class="left"><?php echo $column_ip; ?></td>
                <td class="left"><?php echo $column_login_num; ?></td>
                <td class="left"><?php echo $column_last_login_date; ?></td>
              </tr>
            </thead>
            <tbody>
              <?php if ($ips) { ?>
              <?php foreach ($ips as $ip) { ?>
              <tr>
                <td class="left"><?php echo $ip['ip']; ?></td>
                <td class="left"><?php echo $ip['login_num']; ?></td>
                <td class="left"><?php echo $ip['last_login_date']; ?></td>
              </tr>
              <?php } ?>
              <?php } else { ?>
              <tr>
                <td class="center" colspan="3"><?php echo $text_no_results; ?></td>
              </tr>
              <?php } ?>
            </tbody>
          </table>
        </div>
        <div id="tab_backlist">
          <table class="form">
            <tr>
              <td><?php echo $entry_is_backlist; ?></td>
              <td><input type="radio" name="is_backlist" value="0" checked="checked"/><?php echo $text_no; ?>
                <input type="radio" name="is_backlist" value="1"/><?php echo $text_yes; ?></td>
            </tr>
            <tr>
              <td><?php echo $entry_reason; ?></td>
              <td><textarea name="reason" cols="100" rows="6"></textarea></td>
            </tr>
          </table>
        </div>
      </form>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
$('.htabs a').tabs();
$('.vtabs a').tabs();
//--></script> 
<?php echo $footer; ?>